package SalaryManagementSystem;

public class Employee {
    private static int add;//统计Employee类对象个数在构造方法里面++
    public int getAdd(){//设置add的访问器
        return add;
    }

   private int num;//编号
   private String name;//姓名
   private String sex;//性别
    int age;//年龄
   private String professionalTitle;//职称
   private String educationBackground;//学历
   private String department;//所在部门
   private Boolean isPartymember;//是否党员
   private int basicsalary;//基本工资
   private int jobwage;//岗位工资
    //构造方法
    public Employee(){
        add++;//每次建employee就add++一次
    }
    public Employee(int num,String name,String sex,int age,String professionalTitle,String educationBackground,String department,boolean isPartymember){//编号、姓名、性别、年龄、职称、学历、所在部门、是否党员。
        this.num=num;
        this.name=name;
        this.sex=sex;
        this.age=age;
        this.professionalTitle=professionalTitle;
        this.educationBackground=educationBackground;
        this.department=department;
        this.isPartymember=isPartymember;
        add++;//每次建employee就add++一次
    }
    public Employee(int num, String name, String sex, int age, String professionalTitle, String educationBackground, String department, Boolean isPartymember, int basicsalary, int jobwage) {//参数包括所有成员变量
        this.num = num;
        this.name = name;
        this.sex = sex;
        this.age = age;
        this.professionalTitle = professionalTitle;
        this.educationBackground = educationBackground;
        this.department = department;
        this.isPartymember = isPartymember;
        this.basicsalary = basicsalary;
        this.jobwage = jobwage;
        add++;//每次建employee就add++一次
    }
    //成员方法
    public int realWage(){//实发工资
        return basicsalary+jobwage;
    }//计算实发工资
    public void show(Employee employee){//	输出员工基本信息
        System.out.println(employee);
    }//	输出员工基本信息，内容包括：编号、姓名、性别、年龄、职称、学历、所在部门、是否党员。
    @Override
    public String toString() {
        return "Employee{" +
                "num=" + num +
                ", name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", age=" + age +
                ", professionalTitle='" + professionalTitle + '\'' +
                ", educationBackground='" + educationBackground + '\'' +
                ", department='" + department + '\'' +
                ", 是否党员：" +((isPartymember==true)?"是":"不是") +//如果isPartymember为真则返回是否则返回不是
                ", basicsalary=" + basicsalary +
                ", jobwage=" + jobwage +
                '}';
    }
    public void showSalary(){//	输出工资条信息编号、姓名、职称、基本工资、岗位工资、实发工资。
        System.out.println("num:"+num+"name:"+name+"职称:"+professionalTitle+"基本工资:"+basicsalary+"岗位工资:"+jobwage+"实发工资"+realWage());
    }
//对Employee类的成员变量进行封装。	性别：只能为“男”或“女”。
//	年龄：范围只能限定在20-60。
//	职称：只能“初级”、“中级”和“高级”。
//	基本工资：根据职称划分，初级职称为3000，中级职称为4000，高级职称为5000。
//	岗位工资：范围在1000-3000之间。
    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {//	性别：只能为“男”或“女”。
        if(sex.equals("男")||sex.equals("女")){//当传入参数为男或女时才赋值否则不赋值
            this.sex=sex;
        }else {
            System.out.println("性别错误");
            return;
        }
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {//	年龄：范围只能限定在20-60。
        if(age>=20&&age<=60){//年龄符合赋值否则不赋值
            this.age=age;
        }
        else {
            System.out.println("年龄输入错误");
            return;
        }
    }

    public String getProfessionalTitle() {
        return professionalTitle;
    }

    public void setProfessionalTitle(String professionalTitle) {//	职称：只能“初级”、“中级”和“高级”。
        if (professionalTitle.equals("初级")||professionalTitle.equals("中级")||professionalTitle.equals("高级")){
            this.professionalTitle=professionalTitle;
        }else {
            System.out.println("职称错误");
            return;
        }
    }


    public String getEducationBackground() {
        return educationBackground;
    }

    public void setEducationBackground(String educationBackground) {
        this.educationBackground = educationBackground;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public Boolean getPartymember() {
        return isPartymember;
    }

    public void setPartymember(Boolean partymember) {
        isPartymember = partymember;
    }

    public int getBasicsalary() {//基本工资：根据职称划分，初级职称为3000，中级职称为4000，高级职称为5000。
        if(professionalTitle.equals("初级")){
            this.basicsalary=3000;
        }else if(professionalTitle.equals("中级")){
            this.basicsalary=4000;
        }else {
            this.basicsalary=5000;
        }
        return basicsalary;
    }
    public void setBasicsalary(int basicsalary) {
        this.basicsalary = basicsalary;
    }

    public int getJobwage() {
        return jobwage;
    }

    public void setJobwage(int jobwage) {//岗位工资：范围在1000-3000之间。
        if(jobwage>=1000&&jobwage<=3000){
            this.jobwage=jobwage;
        }
    }
    public class Birthday{//成员内部类Birthday
    private int year;
    private int month;
    private int day;
    public Birthday(int year,int month,int day){
        this.year=year;
        this.month=month;
        this.day=day;
    }
    public void setBirthday(int year,int month,int day){//	设置出生日期SetBirthday，参数包括年、月、日。
        this.year=year;
        this.month=month;
        this.day=day;
    }
        public String getBirthday(){//	获取出生日期GetBirthday,返回值为出生日期值，格式为“XXXX年XX月XX日”。
            String birthday;
            birthday="{"+year+"年"+month+"月"+day+"日"+"}";
            return birthday;
        }
    }
    Birthday birthday;//在Employee类添加一个“出生日期”成员变量，类型为第6定义的Birthday类类型，同时修改Employee类的相关内容。

    public static void main(String[] args) {
        Employee employee=new Employee();
        Birthday birthday1=employee.new Birthday(2002,12,13);
        employee.show(employee);


    }
}
